/**
 * 节流装饰器
 * @param deylay 再次执行函数的执行间隔,单位秒.
 * @constructor
 */
const Throttle = (fn: Function, delay = 200)=>{
    let flag: boolean | null = null
    return function(this: any, ...args: any) {
        if (!flag) {
            flag = true
            setTimeout(() => {
                flag = false;
                fn.call(this, ...args)
            }, delay)
        }
    }
}

export default Throttle